import { Component, PropsWithChildren } from 'react'
import { View, Text } from '@tarojs/components'
import { AtButton } from 'taro-ui'

import "taro-ui/dist/style/components/button.scss" // 按需引入
import './index.scss'

interface IImage {
  id: number
  url: string
}

interface TState {
  dataList:IImage[]
}

export default class Index extends Component<PropsWithChildren> {

  constructor(props: any) {
    super(props)
    this.state = {
      dataList: []
    }
  }

  componentDidMount () {
    let imgList:IImage[]=[]
    for(let i = 1; i < 15; i++) {
      imgList.push({
        id: i,
        url: "https://tbxiaobai.com/wxapi/static/wlop/wlop_001.jpg"
      })
    }
    this.setState({
      dataList: imgList
    })
  }

  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }

  render () {
    return (
      <View className='index'>
        {
          this.state.dataList.map(imgItem => (
            <View key={ imgItem.id }>
              <image mode="heightFix" src={imgItem}></image>
            </View>
          ))
        }
      </View>
    )
  }
}
